# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=8

inherit git-r3 udev

DESCRIPTION="Gentoo scripts for Fpemud OS"
EGIT_REPO_URI="https://gitee.com/fpemud/gentoo-scripts"

KEYWORDS="amd64"
LICENSE="GPL-3"
SLOT="0"
IUSE="session-physical-gui-workstation
      session-vnc-vnc-workstation
      session-rdp-gui-workstation"

RDEPEND="sys-apps/systemd
         app-admin/gentoo-bashrc
         app-admin/load-modules-with-static-node
         app-portage/gentoolkit
         net-misc/stunnel
         net-misc/wget
         sys-apps/nvme-cli
         sys-apps/portage
         dev-util/patchutils
         dev-vcs/git
         dev-vcs/subversion
         sys-boot/grub[grub_platforms_pc,grub_platforms_efi-64,nls,fonts,themes]
         sys-fs/squashfs-tools
         sys-fs/squashfs-tools-ng
         sys-fs/ntfs3g[fuse,suid]
         net-fs/httpdirfs
         >=sys-fs/dosfstools-4.0-r1
         sys-apps/smartmontools
         sys-apps/dmidecode
         sys-apps/pv
         app-arch/xz-utils
         app-arch/zip
         sys-libs/tdb
         dev-python/asyncio-glib
         dev-python/asyncio-pool
         dev-python/bbki[btrfs]
         dev-python/blessed
         dev-python/elemlib
         dev-python/gstage4
         dev-python/lxml
         dev-python/mrget
         dev-python/ntplib
         dev-python/passlib
         dev-python/pygit2
         dev-python/pygobject
         dev-python/pyopenssl
         dev-python/pyparted
         dev-python/python-linux-procfs
         dev-python/python-magic
         dev-python/pyudev
         dev-python/requests
         dev-python/setproctitle
         dev-python/strict_cups
         dev-python/strict_fsh
         dev-python/strict_hdds[btrfs]
         dev-python/strict_hwcfg
         dev-python/strict_nsswitch
         dev-python/strict_openssh
         dev-python/strict_pam
         dev-python/strict_pgs
         dev-python/strict_portage
         dev-python/strict_systemd
         dev-python/tenacity
         dev-python/wstage4
         dev-perl/Digest-SHA1
         dev-perl/Proc-ProcessTable"

# media-video/uxplay: it should be in session-physical-gui-workstation, but it hard depends on avahi
RDEPEND="${RDEPEND}
         session-physical-gui-workstation? (
                 gui-libs/greetd
                 media-video/pipewire
                 media-video/wireplumber
                 media-plugins/gst-plugins-pulse
                 gui-wm/wayfire
                 gui-apps/wf-shell
                 app-i18n/fcitx[-autostart]
                 app-i18n/fcitx-gtk
                 app-i18n/fcitx-qt
                 app-i18n/fcitx-chinese-addons
                 app-misc/brightnessctl
                 gui-apps/wl-clipboard
                 gui-apps/grim
                 gui-apps/slurp
         )
         session-vnc-vnc-workstation? (
                 gui-apps/wayvnc
                 app-i18n/fcitx[-autostart]
                 app-i18n/fcitx-gtk
                 app-i18n/fcitx-qt
         )
         session-rdp-gui-workstation? (
                 gui-libs/greetd
                 media-video/pipewire
                 media-video/wireplumber
                 gui-wm/wayfire
                 gui-apps/wf-shell
                 app-i18n/fcitx[-autostart]
                 app-i18n/fcitx-gtk
                 app-i18n/fcitx-qt
         )"

DEPEND="${RDEPEND}
        virtual/pkgconfig"

# don't install README doc
DOCS=()
HTML_DOCS=()

src_install() {
	default
	if use session-physical-gui-workstation ; then
		dodir /usr/lib/systemd/system
		dosym greetd.service /usr/lib/systemd/system/display-manager.service
	fi
}

pkg_postinst() {
	udev_reload
}

pkg_postrm() {
	udev_reload
}
